home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_redgem.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  404 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_RedGem.cog
  4. #
  5. # [TRM]
  6. #
  7. # GemC = 97 (red)
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15.     message     startup
  16.     message     user0
  17.     message     activated
  18.     message     entered
  19.     message     touched
  20.     message     arrived
  21.     message     sighted
  22.     message     pulse
  23.     
  24.     thing       player      local
  25.     thing       deadIndy    local
  26.     thing       gem
  27.     thing       interpCam
  28.     thing       deathCam
  29.     
  30.     thing       kill_Block0     linkID=1
  31.     thing       kill_Block1     linkID=1
  32.     thing       kill_Block2     linkID=1
  33.     
  34.     thing       block_Block0    linkID=1
  35.     thing       block_Block1    linkID=1
  36.     thing       block_Block2    linkID=1
  37.     thing       block_Block3    linkID=1
  38.     thing       block_Block4    linkID=1
  39.     thing       block_Block5    linkID=1
  40.     
  41.     surface     surf0
  42.     
  43.     sector      trig_Say
  44.     sector      lookAtMe
  45.     
  46.     template    tpl_Indy=indy_sh_actor          local
  47.  
  48.     keyframe    inDie=in_die_buckle.key         local
  49.     
  50.     sound       snd_Gem1=Inxj193.wav    local   # First gem: One of King Sol's jewels.
  51.     sound       snd_Gem2=Inxj194.wav    local   # Second gem: Another Jewel...
  52.     sound       snd_Gem3=Inxj195.wav    local   # Third gem: A third gem...
  53.     
  54.     # ** sfx **
  55.     sound       sfx_Block=sol_block_crash_c.wav         local   # landing blocks
  56.     sound       sndDie=tem_temspikes_up_kill_c.wav      local
  57.     sound       say_Trap=inxj041a.wav                   local   # i sense a trap
  58.     sound       snd_Snakes=Inxj069.wav                  local   # snakes
  59.     sound       say_Ugh=inxj018a.wav                    local   # Ugh...
  60.     
  61.     # ** music **
  62.     sound       snd_Music=mus_gen_danger1.wav           local
  63.     
  64.     cog         blueGem
  65.     cog         greenGem
  66.     cog         fallingDebris
  67.     cog            talkCog                    local
  68.     
  69.     vector      posOffset           local
  70.     vector      angOffset           local
  71.     
  72.     int         gemsFound=0         local
  73.     int         gotIt=0             local
  74.     int         deadMan=0           local
  75.     int         safe=0              local
  76.     int         once=0              local
  77.     int         sighted_Once=0      local
  78.     int         vibe                local
  79.     int         victim              local
  80.     
  81.     # ** subroutines **
  82.     flex        pickUpGem           local
  83.     
  84. end
  85.  
  86. # ========================================================================================
  87.  
  88. code
  89.  
  90. startup:
  91.  
  92.     SetThingLight(gem, '0.8 0.3 0.3', 0.01, 0.1);
  93.     player = GetLocalPlayerThing();
  94.     
  95.     SetCollideType(kill_Block0, 0);
  96.     SetCollideType(kill_Block1, 0);
  97.     SetCollideType(kill_Block2, 0);
  98.     
  99.     SetCollideType(block_Block0, 0);
  100.     SetCollideType(block_Block1, 0);
  101.     SetCollideType(block_Block2, 0);
  102.     SetCollideType(block_Block3, 0);
  103.     SetCollideType(block_Block4, 0);
  104.     SetCollideType(block_Block5, 0);
  105.         
  106.     return;
  107.  
  108. # ========================================================================================
  109.  
  110. user0:
  111.  
  112.     gemsFound = gemsFound + 1;
  113.     return;
  114.     
  115. # ========================================================================================
  116.  
  117. activated:
  118.  
  119.     player = GetLocalPlayerThing();
  120.     
  121.     if((GetSenderRef() == gem) && (gotIt == 0))
  122.     {
  123.         # player activated with an IMP part so bail out
  124.         if((GetCurWeapon(player) >= 14) && (GetCurWeapon(player) <= 18)) return;
  125.         
  126.         # player activated with lighter
  127.         else if(GetCurWeapon(player) == 13)
  128.         {
  129.             gotIt = 1;
  130.             
  131.             # put away the lighter
  132.             DeselectWeapon(player);
  133.             DeselectWeaponWait(player);
  134.             
  135.             Call pickupGem;
  136.         }
  137.         
  138.         # normal activation
  139.         else
  140.         {
  141.             gotIt = 1;
  142.             
  143.             # wait for weapon to be put away
  144.             DeselectWeaponWait(player);
  145.             
  146.             Call pickupGem;
  147.         }
  148.     }
  149.  
  150.     return;
  151.             
  152. # ========================================================================================
  153.  
  154. pickupGem:
  155.  
  156.     # increase gemsfound in the other cogs
  157.     SendMessage(blueGem, user0);
  158.     SendMessage(greenGem, user0);
  159.     
  160.     # do cutscene stuff
  161.     MakeMeStop();
  162.     
  163.     # offset camera
  164.     SetExtCamOffsetToThing(interpCam);
  165.     
  166.     # pick up the gem
  167.     PlayMode(player, 24, 0);
  168.     
  169.     # Call the Pickup Lines cog
  170.     talkCog = GetCogByIndex(0);
  171.     SendMessage(talkCog, 27);
  172.     
  173.     # wait a bit then destroy gem
  174.     Sleep(0.3);
  175.     DestroyThing(gem);
  176.     
  177.     # sleep for a bit to wait for talkCog
  178.     Sleep(1.0);
  179.     
  180.     # add gemc to inventory
  181.     SetInvAvailable(player, 97, 1);
  182.     ChangeInv(player, 97, 1.0);
  183.     JonesInvItemChanged(97);
  184.     
  185.     # play dialog as gems spins into inventory
  186.     if(gemsFound == 0)
  187.     {
  188.         PlayVoice(player, snd_Gem1, 1.0, 1);
  189.     }
  190.     
  191.     else if(gemsFound == 1)
  192.     {
  193.         PlayVoice(player, snd_Gem2, 1.0, 1);
  194.     }
  195.     
  196.     else if(gemsFound == 2)
  197.     {
  198.         PlayVoice(player, snd_Gem3, 1.0, 1);
  199.     }
  200.     
  201.     # return control to player
  202.     ClearActorFlags(player, 0x200000);
  203.     
  204.     # increase gemsfound in this cog
  205.     gemsFound = gemsFound + 1;
  206.     
  207.     RestoreExtCam();
  208.     
  209.     # rest to let camera return
  210.     #Sleep(1.0);
  211.     Sleep(0.5);
  212.     
  213.     # turn on falling debris
  214.     SendMessage(fallingDebris, user0);
  215.     SetPulse(0.1);
  216.     
  217.     # drop first row block blocks to block exit
  218.     #PlaySoundThing(sfx_Block, block_Block0, 1.0, 5.0, 10.0, 0);
  219.     movetoframe(block_Block0, 1, 8.0);
  220.     Sleep(0.1);
  221.     PlaySoundThing(sfx_Block, block_Block1, 1.0, 5.0, 10.0, 0);
  222.     movetoframe(block_Block1, 1, 8.0);
  223.     Sleep(0.25);
  224.     PlaySoundThing(sfx_Block, block_Block2, 1.0, 5.0, 10.0, 0);
  225.     movetoframe(block_Block2, 1, 8.0);
  226.     
  227.     # give 3dos collision back after they pass thru geometry
  228.     SetCollideType(block_Block0, 3);
  229.     SetCollideType(block_Block1, 3);
  230.     SetCollideType(block_Block2, 3);
  231.     
  232.     # drop second row
  233.     #PlaySoundThing(sfx_Block, block_Block3, 1.0, 5.0, 10.0, 0);
  234.     movetoframe(block_Block3, 1, 8.0);
  235.     Sleep(0.25);
  236.     PlaySoundThing(sfx_Block, block_Block4, 1.0, 5.0, 10.0, 0);
  237.     movetoframe(block_Block4, 1, 8.0);
  238.     Sleep(0.1);
  239.     PlaySoundThing(sfx_Block, block_Block5, 1.0, 5.0, 10.0, 0);
  240.     movetoframe(block_Block5, 1, 8.0);
  241.     
  242.     # give 3dos collision back after they pass thru geometry
  243.     SetCollideType(block_Block3, 3);
  244.     SetCollideType(block_Block4, 3);
  245.     SetCollideType(block_Block5, 3);
  246.     
  247.     WaitForStop(block_Block5);
  248.     ClearAdjoinFlags(surf0, 2);         # no move
  249.     
  250.     # drop kill blocks
  251.     #PlaySoundThing(sfx_Block, kill_Block0, 1.0, 5.0, 10.0, 0);
  252.     movetoframe(kill_Block0, 1, 8.0);
  253.     Sleep(0.25);
  254.     PlaySoundThing(sfx_Block, kill_Block1, 1.0, 5.0, 10.0, 0);
  255.     movetoframe(kill_Block1, 1, 8.0);
  256.     Sleep(0.15);
  257.     PlaySoundThing(sfx_Block, kill_Block1, 1.0, 5.0, 10.0, 0);
  258.     movetoframe(kill_Block2, 1, 8.0);
  259.     
  260.     # give 3dos collision back after they pass thru geometry
  261.     SetCollideType(kill_Block0, 3);
  262.     SetCollideType(kill_Block1, 3);
  263.     SetCollideType(kill_Block2, 3);
  264.     
  265.     # turn off falling debris
  266.     Sleep(4.0);
  267.     SendMessage(fallingDebris, user1);
  268.     SetPulse(0.0);
  269.     
  270.     return;
  271.  
  272. # ========================================================================================
  273.  
  274. entered:
  275.  
  276.     if((GetSenderRef() == trig_Say) && (once == 0))
  277.     {
  278.         once = 1;
  279.         PlayVoice(player, say_Trap, 1.0, 0);
  280.         PlaySoundLocal(snd_Music, 1.0, 0.0, 0x0, 0);
  281.     }
  282.     
  283.     return;
  284.     
  285. # ========================================================================================
  286.  
  287. touched:
  288.  
  289.     if((deadMan == 1) || (safe == 1)) return;
  290.  
  291.     if(GetSenderID() == 1)
  292.     {
  293.         deadMan = 1;
  294.         
  295.         # remove collisions so blocks pass thru player
  296.         SetCollideType(kill_Block0, 0);
  297.         SetCollideType(kill_Block1, 0);
  298.         SetCollideType(kill_Block2, 0);
  299.         
  300.         SetCollideType(block_Block0, 0);
  301.         SetCollideType(block_Block1, 0);
  302.         SetCollideType(block_Block2, 0);
  303.         SetCollideType(block_Block3, 0);
  304.         SetCollideType(block_Block4, 0);
  305.         SetCollideType(block_Block5, 0);
  306.         
  307.         # cut to deathCam
  308.         SetCameraFocus(2, deathCam);
  309.         SetCameraSecondaryFocus(2, player);
  310.         SetCurrentCamera(2);
  311.         Sleep(0.01);
  312.         
  313.         # kill the player
  314.         DamageThing(player, 1000.0, 0x1, victim);
  315.         Sleep(0.1);
  316.         PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  317.         PlaySoundLocal(say_Ugh, 1.0, 0.0, 0x0, 0);
  318.                             
  319.         # hide player
  320.         SetThingFlags(player, 0x80000);
  321.         
  322.         # create actor indy
  323.         deadIndy = CreateThing(tpl_Indy, player);
  324.         CaptureThing(deadIndy);
  325.                             
  326.         # Show actor Indy and play Keyframe
  327.         ClearThingFlags(deadIndy, 0x80000);
  328.         PlayKey(deadIndy, inDie, 4, 0x14, 1);
  329.     }
  330.  
  331.     return;
  332.     
  333. # ========================================================================================
  334.  
  335. arrived:
  336.  
  337.     if((GetSenderRef() == kill_Block2) && (safe == 0))
  338.     {
  339.         # it's safe to touch the blocks now
  340.         safe = 1;
  341.         
  342.         # play falling block sound again
  343.         PlaySoundThing(sfx_Block, block_Block5, 1.0, 5.0, 10.0, 0);
  344.         
  345.         # reset proper collision on kill blocks
  346.         SetCollideType(kill_Block0, 3);
  347.         SetCollideType(kill_Block1, 3);
  348.         SetCollideType(kill_Block2, 3);
  349.         
  350.         # retore interpCam back to player
  351.         #RestoreExtCam();
  352.     }
  353.     
  354.     return;
  355.  
  356. # ========================================================================================
  357.  
  358. sighted:
  359.  
  360.     if((GetSenderRef() == lookAtMe) && (sighted_Once == 0))
  361.     {
  362.         Print("sighted");
  363.         sighted_Once = 1;
  364.         PlayVoice(player, snd_Snakes, 1.0, 1);
  365.     }
  366.  
  367.     return;
  368.  
  369. # ========================================================================================
  370.  
  371. pulse:
  372.  
  373.     # shake the camera
  374.     vibe = RandBetween(1, 4);
  375.     if (vibe == 1)
  376.     {
  377.         posOffset = '-0.005 0.00 -0.002';
  378.         angOffset = '0.00 -0.002 0.002';
  379.     }
  380.     if (vibe == 2)
  381.     {
  382.         posOffset = '0.005 -0.005 0.002';
  383.         angOffset = '0.002 0.00 -0.002';
  384.     }
  385.     if (vibe == 3)
  386.     {
  387.         posOffset = '0.002 0.005 -0.005';
  388.         angOffset = '-0.002 0.002 -0.002';
  389.     }
  390.     if (vibe == 4)
  391.     {
  392.         posOffset = '-0.002 0.00 0.005';
  393.         angOffset = '0.00 0.00 0.002';
  394.     }
  395.  
  396.     SetPOVShake(posOffSet, angOffSet, 200.0, 200.0);
  397.     
  398.     return;
  399.     
  400. # ========================================================================================
  401.         
  402. end
  403.  
  404.